<admintpl file="header"/>
</head>
<body>
<div class="wrap">
	<form class="form-horizontal js-ajax-form" method="post" action="">
		<div class="control-group">
			<label class="control-label" for="test">请勾选不符合的条件</label>
			<div class="controls">
				<label><input type="checkbox" name="refuse_reason[]" value='apply_name'>认证名称</label>
				<label><input type="checkbox" name="refuse_reason[]" value='real_name'>真实姓名</label>
				<label><input type="checkbox" name="refuse_reason[]" value='identity_card'>身份证号</label>
				<label><input type="checkbox" name="refuse_reason[]" value='multiclass_photo'>职称/称号/营业执照</label>
				<label><input type="checkbox" name="refuse_reason[]" value='handheld_photo'>手持身份证</label>
				<label><input type="checkbox" name="refuse_reason[]" value='identity_photo'>身份证正面</label>
				<label><input type="checkbox" name="refuse_reason[]" value='description'>认证说明:</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="content">不通过原因描述</label>
			<div class="controls">
				<textarea type="text" class="input-xlarge" id="content"
				          name="reason_describe"></textarea>
				<span class="help-block"></span>
			</div>
		</div>
		<input type="hidden" name="apply_id" value="{$apply_id}">
		<div class="form-actions">
			<button class="btn btn-primary js-ajax-submit" type="submit" id="closeIframe">添加</button>
			<!--&lt;!&ndash;<a class="btn" href="javascript:history.back(-1);">返回</a>&ndash;&gt;-->
		</div>
	</form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    //关闭iframe
    $('#closeIframe').click(function () {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        var apply_id = $('input[name="apply_id"]').val();
        var obj = $('input[name="refuse_reason[]"]:checked');
        var content = $('#content').val();
        var refuseReason = new Object();
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].checked) {
                refuseReason[i] = obj[i].value;
            }
        }
        if (obj.length == 0) {
            parent.layer.msg('请勾选不符合的条件');
            return;
        }
        if (content === '') {
            parent.layer.msg('请填写不通过的原因');
            return;
        }
        submitMessage(refuseReason, content, apply_id);
        
    });

    function submitMessage(refuseReason, content, apply_id) {
        var url = "{:U('AdminVerify/rebut')}";
        var value = {'refuse_reason': refuseReason, 'content': content, 'apply_id': apply_id};
        $.ajax({
                url: url,
                type: 'POST',
                dataType: 'json',
                data: value,
                success: function (ret) {
                    alert(ret.msg);
//	                setTimeout(parent.location.reload(),3000);
	                 parent.rsatest = true;
	                 parent.layer.close(index);
                },
                error: function (err) {
                    alert(JSON.stringify(err.msg));
                }
            }
        );
    }


</script>
</body>